<template>
  <div>
    app
    <p @click="addNum">{{state.num}}</p>
    <p v-for="item of state.lists" :key="item">{{item}}</p>
  </div>
</template>

<script>

import {reactive} from 'vue'
//使用ref可以在setup函数中定义一个变量
  export default {
    name:'App',
    setup() {
      const state = reactive({
        lists:[1,2,3],
        num:1
      })
      const addNum =()=>{
        state.num++
        
      }
      return {
        state,
        addNum
      }
    }
  }
</script>

<style scoped>

</style>